package com.easy.venue.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easy.common.bean.SeatPriceBean;
import com.easy.common.service.ISeatPriceService;
import com.easy.common.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/seatprice")
@RestController
@CrossOrigin
public class SeatPriceController {
    @Autowired
    ISeatPriceService seatPriceService;

    //新增订单
    @PostMapping("/add")
    public Result addSeatPrice(@RequestBody SeatPriceBean seatPrice){
        Object seatPrice_data = seatPriceService.addSeatPrice(seatPrice);
        return Result.success(seatPrice_data);
    }
    //软删除订单
    @DeleteMapping("/delete/{id}")
    public Result deleteSeatPrice(@PathVariable("id") Integer id){
        Object seatPrice_data = seatPriceService.deleteSeatPrice(id);
        return Result.success(seatPrice_data);
    }
    //edit修改用户信息
    @PutMapping("/edit")
    public Result uploadSeatPrice(@RequestBody SeatPriceBean seatPrice){
        Object seatPrice_data = seatPriceService.updateSeatPrice(seatPrice);
        return Result.success(seatPrice_data);
    }
    //根据id查询订单信息
    @GetMapping("/get/{id}")
    public Result getSeatPriceById(@PathVariable("id") Integer id){
        Object seatPrice_data = seatPriceService.getSeatPriceById(id);
        return Result.success(seatPrice_data);
    }
    //查询所有订单信息
    @GetMapping("/all")
    public Result getAll(SeatPriceBean  seatPrice){
        Object seatPrice_data = seatPriceService.getAll(seatPrice);
        return Result.success(seatPrice_data);
    }
    //分页查询订单信息
    @GetMapping("/page")
    public Result getPage(SeatPriceBean seatPrice, Page<SeatPriceBean> page){
        seatPriceService.getPage(seatPrice,page);
        return Result.success(page);
    }
    @GetMapping("/getbyseatid/{seatid}")
    public Result getSeatPriceBySeatId(@PathVariable("seatid") Integer seatid){
        Object seatPrice_data = seatPriceService.getSeatPriceBySeatId(seatid);
        return Result.success(seatPrice_data);
    }

}
